<template>
  <base-option :selected="selected" :field-config="fieldConfig" :form-config="formConfig">
    <template #default="{ hideOptions }">
      <el-form-item v-if="hideOptions('limit')" label="附件数量">
        <el-input-number v-model="fieldConfig.limit" :min="1" :max="10" controls-position="right" />
      </el-form-item>
      <el-form-item v-if="hideOptions('fileMaxSize')" label="附件大小">
        <el-input-number v-model="fieldConfig.fileMaxSize" :min="1" :max="50" controls-position="right" />
      </el-form-item>
      <el-form-item v-if="hideOptions('tip')" label="上传提示">
        <el-input v-model="fieldConfig.tip" placeholder="" style="font-size: 13px" />
      </el-form-item>

      <el-form-item v-if="hideOptions('listType')" label="展示风格">
        <el-select v-model="fieldConfig.listType" placeholder="">
          <el-option label="文件" value="text" />
          <el-option label="小图标" value="picture" />
          <el-option label="大图标" value="picture-card" />
        </el-select>
      </el-form-item>

      <el-form-item v-if="hideOptions('accept')" label="限制文件类型(多个类型，逗号分隔)">
        <el-input
          v-model="fieldConfig.accept"
          type="textarea"
          maxlength="100"
          placeholder="如：.doc,.docx,.pdf"
          autosize
        />
      </el-form-item>
    </template>
  </base-option>
</template>

<script setup>
import { toRefs } from 'vue'
import baseOption from './base-option.vue'
import propsDefinition from './props'
const props = defineProps(propsDefinition)
const { selected, fieldConfig, formConfig } = toRefs(props)
</script>
